package main

import (
	"fmt"
	"runtime"
)

func main() {
	//runtime.GOMAXPROCS(runtime.NumCPU())
	runtime.GOMAXPROCS(1)
	c := make(chan bool)
	for i := 0; i < 10; i++ {
		//fmt.Println(i)

		go Go(c, i)
		//time.Sleep(1 * time.Second)
		//fmt.Println("EFEFEF")
	}
	<-c
	fmt.Println("OK")
	//time.Sleep(10 * time.Second)

}
func Go(c chan bool, index int) {
	fmt.Println(index)
	a := 1
	for i := 0; i < 10000000; i++ {
		a += i
	}
	fmt.Println(index, a)
	if index == 8 {
		c <- true
	}
}
